package com.charles.video.api.feignFallBack;

import com.charles.video.api.domain.MemberLog;
import com.charles.video.api.feignService.RemoteLogService;
import com.charles.video.common.core.responseDomain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteLogServiceFallbackFactory implements FallbackFactory<RemoteLogService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteLogServiceFallbackFactory.class);

    @Override
    public RemoteLogService create(Throwable throwable) {
        log.error("日志服务调用失败:{}", throwable.getMessage());
        return new RemoteLogService() {
            @Override
            public R<Boolean> saveLog(MemberLog memberLog, String source) {
                return null;
            }
        };

    }
}
